﻿<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl" %>

<script type="text/javascript">

    function submits() {
        var login_id = $("#login_id").val();
        var user_name = $("#user_name").val();
        var login_password = $("#login_password").val();
        var auth_id = $("#auth_id").val();
        var spqx = $("#spqx").val();
        var staff_id = $("#staff_id").val();
        if ("" == login_id) {
            alert("账号不能为空！");
            return false;
        }
        if ("" == user_name) {
            alert("姓名不能为空！");
            return false;
        }
        if ("" == login_password || login_password.length < 6) {
            alert("密码不能为空且长度须大于6");
            return false;
        }
        if ("" == auth_id) {
            alert("请选择权限！");
            return false;
        }
        if ("" == spqx) {
            alert("请选择审批权限！");
            return false;
        }
        if ("" == staff_id) {
            alert("请选择员工！");
            return false;
        }
        return true;

    };

    function proRes(ajaxContext) {
        var restag = {};
        try {
            restag = ajaxContext.get_response().get_object();
        } catch (e) {
            alert("程序出现错误，请联系管理员");
            return;  // return if result is not json
        }

        if (restag.res != true) {
            alert(restag.msg);
            return;
        }
        else {
            alert("操作成功");
            $.fn.deltab('6-1');
            $('#menu_alluserlist').trigger('click');
        }
    }
    
</script>

<div style="padding-top: 5px; padding-left: 10px; width: 1080px;">
    <%using (Ajax.BeginForm("DoUserAdd", "Basic", new AjaxOptions { UpdateTargetId = "temp", OnSuccess = "proRes" }))
      { %>
    <div style="width: 100%;">
        <input type="submit" value="提交" onclick="return submits()" /></div>
    <div class="leftLand" style="width: 320px;">
        <p style="margin: 10px 0;">
            <span style="padding-left: 25px;">账号:</span><%=Html.TextBox("login_id", "", new { @style = "width:200px; margin-left:8px; border:solid 1px #6C92AD;" })%></p>
        <%--     <p style="margin: 10px 0;">
            <span style="padding-left: 25px;">姓名:</span><%=Html.TextBox("user_name", "", new { @style = "width:200px; margin-left:8px; border:solid 1px #6C92AD;" })%></p>--%>
        <p style="margin: 10px 0;">
            <span style="padding-left: 25px;">密码:</span><%=Html.Password("login_password", "", new { @style = "width:200px; margin-left:8px; border:solid 1px #6C92AD;" })%></p>
        <p style="margin: 10px 0;">
            <span style="padding-left: 25px;">员工:</span><%=Html.DropDownList("staff_id", ViewData["list_staff"] as List<SelectListItem>, "---------请选择---------", new { @style = "width:202px; margin-left:8px; padding:0px;border-radius:0px 0px 0px 0px;border:solid 1px #6C92AD;" })%></p>
        <p style="margin: 10px 0;">
            <span style="padding-left: 25px;">权限:</span><%=Html.DropDownList("auth_id", null, "---------请选择---------", new { @style = "width:202px; margin-left:8px; padding:0px;border-radius:0px 0px 0px 0px;border:solid 1px #6C92AD;" })%></p>
        <p style="margin: 10px 0;">
            审批权限:<%=Html.DropDownList("spqx", ViewData["list_spqx"] as List<SelectListItem>, "---------请选择---------", new { @style = "width:202px; margin-left:8px; padding:0px;border-radius:0px 0px 0px 0px;border:solid 1px #6C92AD;" })%></p>
    </div>
    <%} %>
</div>
